# Contributor: Eloi Torrents <eloitor@disroot.org>
# Maintainer: Eloi Torrents <eloitor@disroot.org>
pkgname=osmin
pkgver=1.9.7
pkgrel=0
_libosmscout_version=1.9-20230212
pkgdesc="GPS Navigator On-Road/Off-Road"
url="https://github.com/janbar/osmin"
arch="all !armhf !s390x"
# armhf: qt5-qtsensors-dev, qt5-qtlocation-dev
# s390x: openmp-dev
license="GPL-3.0-only"
makedepends="
	clang
	cmake
	gnu-libiconv-dev
	libmarisa-dev
	libxml2-dev
	openmp-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtsvg-dev
	qt5-qtquickcontrols2-dev
	qt5-qtsensors-dev
	qt5-qtmultimedia-dev
	qt5-qtremoteobjects-dev
	qt5-qtlocation-dev
	samurai
	"
options="!check" # no test suite
source="$pkgname-$pkgver.tar.gz::https://github.com/janbar/osmin/archive/refs/tags/$pkgver.tar.gz
	$pkgname-osmscout-$pkgver.tar.gz::https://github.com/janbar/libosmscout/archive/refs/tags/osmin-$_libosmscout_version.tar.gz
	system-libmarisa.patch
	cpp-locale.patch
	"

prepare() {
	rmdir backend/libosmscout
	mv -v ../libosmscout-$pkgname-$_libosmscout_version backend/libosmscout
	default_prepare
}

build() {
	CFLAGS="$CFLAGS -I/usr/include/gnu-libiconv" \
	CXXFLAGS="$CXXFLAGS -I/usr/include/gnu-libiconv" \
	LDFLAGS="$LDFLAGS -liconv" \
	cmake -B build -G Ninja -Wno-dev \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_C_COMPILER=clang \
		-DCMAKE_CXX_COMPILER=clang++ \
		-DCMAKE_BUILD_TYPE=Release \
		-DBUILD_DEPENDENCIES=OFF
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
facfb9fe3a437842be5a3d2b332549b0df6608717be98051a24e95e59e024276f853716bc6479e93abfbb868997bde97fd558943a8227dfc870b001dd40803da  osmin-1.9.7.tar.gz
f4a8628a7e8a267b5c81e3b9e92219538515add64ed343d6795e6d9b23947c560a3e151c5ecbb241052f20eda02d32b08ce85793038b651180339c6bf2e6af60  osmin-osmscout-1.9.7.tar.gz
034ac53631e1ba1dc8e6af4727664584e4adb015573ae632aaf12d73ea2b0eab1526b93a25c63cda497aec91486ec4cfe6ba0e9aa97227b59a168411b7dee5c7  system-libmarisa.patch
9b80f943701d790b8b6ad012234c4e36f3a76b0ccb2ed34c62082fa81488cab9d737de97062cdc59d1a74ed6a9064347bc7115af2362111f73f64505640c04a2  cpp-locale.patch
"
